#include <iostream>
#include <cstring>
using namespace std;

typedef long long ll;

const int N = 200010; //最大的n

int n;
int a[N];         //用来存y
int num[N];       //用来存某段区间内某个y出现了几次
int num_tr[N];    //num对应的树状数组
int Greater[N];   //x从1~i-1中大于yi的数的数量
int Lower[N];     //x从1~i-1中小于yi的数的数量
ll V = 0, A = 0; //记录V字型和A字型出现的次数

inline int lowbit(int x)
{
    return x & -x;
}

void add(int i, int c)
{
    num[i] += c;
    for (int j = i; j <=n; j += lowbit(j))
        num_tr[j] += c;
    return;
}

int sum(int x) //1~x求和
{
    int sum = 0;
    for (int i = x; i > 0; i-=lowbit(i))
        sum += num_tr[i];
    return sum;
}

int main()
{
    freopen("cin.txt", "r", stdin);
    cin >> n;
    for (int i = 1; i <= n; ++i) //顺着过去算的是左边
    {
        cin >> a[i];
        Greater[i] = sum(n) - sum(a[i]); //计算截止到现在为止，也就是1~i区间内，大于i的数有多少
        Lower[i] = sum(a[i] - 1);        //一样的，小于i的数有多少
        add(a[i], 1);                    //然后数字a[i]又多了一次
    }
    memset(num, 0, sizeof num);       //因为马上要逆着算右边的了
    memset(num_tr, 0, sizeof num_tr); //同步初始化
    for (int i = n; i > 0; --i)       //逆着算右边
    {
        A += ll(Lower[i]) * sum(a[i] - 1); //以前算的左边的还有现在算的右边的
        V += ll(Greater[i]) * (sum(n) - sum(a[i]));
        add(a[i], 1);
    }
    cout << V << " " << A;
    return 0;
}